<!DOCTYPE html>
<html>
<#include "../head.html">
    <body class="full">
    <div class="mc">
        <div class="mc-l">
            <!--左侧导航---{-->
            <div id="navPanelContainer">
                <div class="system-logo cd"></div>
                <!--管理员信息---{-->
                <#include "../adminInfo.html">
                    <!--管理员信息---}-->
                    <div class="nav-wrap">
                        <#include "left.html">
                    </div>
            </div>
            <!--左侧导航---}-->
        </div>
        <div class="mc-m">
            <div class="navToggle"></div>
        </div>
        <div class="mc-r">
            <!--顶部导航---{-->
            <#include "../topNav.html">
                <!--顶部导航---}-->

                <!--面包屑导航---{-->
                <#assign moduleName="投资统计(时间)">
                    <#include "banner.html">
                        <!--面包屑导航---}-->
                        <div style="height:33px;line-height:22px;margin-left:86px;margin-top:21px">
                            <div style="height:px;line-height:22px;float:left;">显示日期：
                                <input class="_search-value" name="start" id="start" value="" onclick="change_picktime('yyyy-MM-dd')"/>
                            </div>
                            <div style="height:22px;line-height:22px;float:left;margin:0 8px;"> 到
                                <input class="_search-value" name="end" id="end" value=""  onclick="change_picktime('yyyy-MM-dd')"/>
                            </div>
                            <input type="checkbox" value="compare" style="margin-left:5px" onClick="showOrHide();"/>和其他时间段对比

                            <select name="weekOrMonth" id="weekOrMonth" style="height:25px;width:100px;margin-left:15px">
                                <option value="day" >按日</option>
                                <option value="week" >按周</option>
                                <option value="month" >按月</option>
                            </select>

                            <div id="compareDiv" hidden="hidden" style="height:33px;line-height:22px;margin-left:24px;margin-top:10px">
                                <div style="height:px;line-height:22px;float:left;">日期：
                                    <input class="_search-value" name="start" id="thestart" value="" onclick="change_picktime('yyyy-MM-dd')"/>
                                </div>
                                <div style="height:22px;line-height:22px;float:left;margin:0 8px;"> 到
                                    <input class="_search-value" name="end" id="theend" value=""  onclick="change_picktime('yyyy-MM-dd')"/>
                                </div>
                            </div>
                        </div>
                        <!--列值  -->
                        <div style="height:62px;line-height:25px;margin-left:80px;margin-top:26px">
                            <form id="myform" >
                                <input   type="checkbox" value="2" />激活数
                                <input type="checkbox" value="3" />注册数
                                <input type="checkbox" value="4"/>注册率
                                <input type="checkbox" value="5"/>实名数
                                <input type="checkbox" value="6"/>认证率
                                <input type="checkbox" value="7"/>投资人数
                                <input type="checkbox" value="8"/>首投人数
                                <input type="checkbox" value="9"/>首投占比
                                <input type="checkbox" value="10"/>首投金额
                                <input type="checkbox" value="11"/>投资总额
                                <input type="checkbox" value="12"/>回款额
                                <input type="checkbox" value="18"/>提现金额
                                <input type="checkbox" value="13"/>新增待收
                                <input type="checkbox" value="14"/>人均投资
                                <input type="checkbox" value="15"/>平均期限
                                <input type="checkbox" value="16"/>年化投资额
                                <input type="checkbox" value="17"/>回款复投率
                                <!-- <input type="button" value="确定" onclick="test()" /> -->
                            </form>
                        </div>
                        <div style="height:62px;line-height:22px;margin-left:80px;margin-top:-16px">
                            <input type="button" value="确定"  class="input-button" onclick="timeSearch();"/>
                        </div>
                        <!--列值  -->
                        <!--图形插件  -->
                        <div id="container" style="width: 1600px; height: 500px; margin: 0 auto"></div>
                        <!--图形插件-->
                        <!--工具栏--{-->
                        <div id="toolbar" class="clearfix">
                            <div id="currentTimeBalance" class="toolbor-module export">
                                &nbsp;&nbsp;&nbsp;站岗资金：${currentTimeBalance}元<br/>
                            </div>
                            <div id="investmentAll" class="toolbor-module export" >
                                投资总额：${investmentAll}元<br/>
                            </div>
                            <div id="collectionAll" class="toolbor-module export">
                                新增待收总额：${collectionAll}元<br/>
                            </div>
                            <div id="yearAccountAll" class="toolbor-module export">
                                年化总额：${yearAccountAll}元<br/>
                            </div>
                            <div id="currentTimeCollection" class="toolbor-module export">
                                实时待收额：${currentTimeCollection}元<br/>
                            </div>

                            <!--  <div class="toolbor-module search" style="float:left;" >
                                 <div style="height:px;line-height:22px;float:left;">投资时间：</div>
                                 <input class="_search-value" name="startDate" id="startDate" value="" onclick="change_picktime()"/>
                                 <div style="height:22px;line-height:22px;float:left;margin:0 8px;"> 到 </div>
                                 <input class="_search-value" name="endDate" id="endDate" value=""  onclick="change_picktime()"/>

                             </div>
                             <div class="toolbor-module search"  >
                                 <input type="button" value="搜索"  class="input-button" onclick="sousuo();">
                             </div> -->


                        </div>
                        <!--工具栏--}-->
                        <!--表格--->
                        <div id="main" class="clearfix">
                            <table class="data-list">
                                <tr class="header">
                                    <td>日期</td>
                                    <td>激活数</td>
                                    <td>注册数</td>
                                    <td>注册率</td>
                                    <td>实名认证</td>
                                    <td>认证率</td>
                                    <td>投资人数</td>
                                    <td>首投人数</td>
                                    <td>首投金额</td>
                                    <td>投资总额</td>
                                    <td>首投占比</td>
                                    <td>回款额</td>
                                    <td>提现金额</td>
                                    <td>新增待收</td>
                                    <td>人均投资</td>
                                    <td>平均期限</td>
                                    <td>年化投资额</td>
                                    <td>回款复投率</td>
                                </tr>
                                <#if list?? && (list?size) gt 0 >
                                    <#list list as item>
                                        <#assign a=(item.registerNum/item.activeNum*100)?string('0.00')/><!-- 注册率 -->
                                        <#assign b=(item.realNameNum/item.registerNum)*100/><!-- 实名认证率 -->
                                        <#assign c=item.newInvestmentAccount/item.investmentTotal*100/><!--首投率  -->
                                        <#assign d=item.investmentTotal-item.paymentAccount/><!-- 新增待收 -->
                                        <#assign e=item.investmentTotal/item.investmentNum/><!-- 人均投资-->
                                        <#assign f=(item.avgLimit/30)/><!-- 平均投资期限-->
                                        <#assign g=(item.investmentTotal-item.newInvestmentAccount)/item.paymentAccount*100/>
                                        <tr class="s">
                                            <td>${item.selectTime}</td>
                                            <td>${(item.activeNum?c)!0}</td>
                                            <td>${item.registerNum?c}</td>
                                            <td>${a}%</td>
                                            <td>${item.realNameNum}</td>
                                            <td>${b?string('0.00')}%</td>
                                            <td>${item.investmentNum}</td>
                                            <td>${item.newInvestmentNum}</td>
                                            <td>${item.newInvestmentAccount?c}</td>
                                            <td>${item.investmentTotal?c}</td>
                                            <td>${c?string('0.00')}%</td>
                                            <td>${item.paymentAccount?c}</td>
                                            <td>${item.balanceCashNum?c}</td>
                                            <td>${d?c}</td>
                                            <td>${e?string('0.00')}</td>
                                            <td>${f?string('0.00')}月</td>
                                            <td>${item.yearInvestment?c}</td>
                                            <td>${g?string('0.00')}%</td>

                                        </tr>
                                    </#list>
                                </#if>
                            </table>
                            <!--表格--->
                            <!--底部工具栏--{-->
                            <!--  <div id="bottomToolbar" class="clearfix">
                                 <div class="other-tool">
                                     <dl class="refresh-data">
                                         <dt class="refresh-data-icon"></dt>
                                         <dd><a href="javascript:void(0);" class="refresh-page">刷新数据</a></dd>
                                     </dl>
                                 </div> -->

                            <!--翻页系统--{-->
                            <!-- <div class="container">
                                <#import "../../common/page.html" as pager>
                                    <@pager.pagination page=page url="${pageUrl}" map=param style="style1" />
                            </div> -->
                            <div id="Page" class="container">
                                <span id="totalNum">共${page.total}条</span>
                                <span id="currentPage">当前第1页</span>
                                <a onclick="page('first')">首页</a>
                                <a onclick="page('before')">上一页</a>
                                <a onclick="page('after')">下一页</a>
                                <a onclick="page('last')">尾页</a>
                            </div>
                            <!--翻页系统--}-->
                            <!-- </div>  -->
                            <!--底部工具栏--}-->
                            <title>jquery图表插件Highcharts之线条图表</title>
                            <script type="text/javascript" src="${request.getContextPath()}/themes/simagejs/jquery.min.js"></script>
                            <script type="text/javascript" src="${request.getContextPath()}/themes/simagejs/highcharts.js"></script>
                            <!--[if IE]>
                            <script type="text/javascript" src="js/excanvas.compiled.js"></script>
                            <![endif]-->
                            <script src="${request.getContextPath()}/themes/sortjs/jquery-latest.min.js"></script>
                            <script src="${request.getContextPath()}/themes/sortjs/jquery.tablesort.min.js"></script>

                            <script type="text/javascript">
                                $(function(){
                                    $('table.data-list').tablesort().data('tablesort');
                                    $('.number').data('sortBy', function(th, td, sorter) {
                                        return parseFloat(td.text());
                                    });
                                });
                                //----变量


                                var type=0;
                                var chart;
                                var yarray=[];
                                var xarray=[];
                                var alllist=new Array();
                                alllist =${jsonString};
                                var columnArr=['激活数','注册数','注册率','实名认证','认证率','投资人数','首投人数','首投占比','首投金额','投资总额','回款额','新增待收','人均投资','平均期限','年化投资额','回款复投率','提现金额'];
                                //-----用于两个时间段的比较 S:
                                var xOneArr=[];
                                var xTwoArr=[];
                                var yOneArr=[];
                                var yTwoArr=[];
                                var oneList=new Array();
                                var twoList=new Array();
                                var flag=0;//是否勾中“和其他时间段对比” 0：未勾中，1：勾中
                                //-----用于两个时间段的比较 E:
                                //-----判断开始和结束时间是否改变S：
                                var refreshList=new Array();

                                var totalNum=${page.total};//总条数
                                var currentPage=1;//当前页
                                var totalPage=parseInt(page.total/10)+1;//总页数

                                //-----判断开始和结束时间是否改变E:
                                //----变量
                                var url = 'queryInvestmentStatitics.html?search=true';
                                function sousuo(){
                                    var sou = "";
                                    var startDate = $("#start").val();
                                    var endDate = $("#end").val();


                                    if (startDate!=null){
                                        sou += "&startTime="+startDate;
                                    }
                                    if (endDate!=null){
                                        sou += "&endTime="+endDate;
                                    }

                                    if (sou!=""){
                                        location.href=url+sou;
                                    }
                                }

                                function showOrHide(){
                                    if(flag==0){
                                        $("#compareDiv").show();
                                        flag=1;
                                    }else if(flag==1){
                                        $("#compareDiv").hide();
                                        flag=0;
                                    }

                                }
                                //点击确定按钮
                                function timeSearch(){

                                    refreshTable();//刷新表格数据

                                    if(flag==1){//勾中了"和其他时间段对比的复选框"
                                        if($('#weekOrMonth').val() !="day"){
                                            alert("请选择按日统计");
                                            return null;
                                        }
                                        if($('#thestart').val()==""||$('#theend').val()==""){
                                            alert("请选择对比时间");
                                            return null;
                                        }
                                        $.ajax({
                                            url: '/admin/statistics/queryInvestmentStatiticsByTime.html',
                                            type: 'post',
                                            data:{
                                                "type":"compare",
                                                "start":$('#start').val(),
                                                "end":$('#end').val(),
                                                "thestart":$('#thestart').val(),
                                                "theend":$('#theend').val()
                                            },
                                            dataType: 'json',
                                            success: function (data) {
                                                xOneArr.length=0;
                                                xTwoArr.length=0;
                                                yOneArr.length=0;
                                                yTwoArr.length=0;
                                                oneList.length=0;
                                                twoList.length=0;
                                                oneList=data.resultData.resultOne;
                                                twoList=data.resultData.resultTwo;
                                                for(var i=oneList.length-1;i>=0;i--){
                                                    xOneArr.push(oneList[i].selectTime);
                                                }
                                                for(var i=twoList.length-1;i>=0;i--){
                                                    xTwoArr.push(twoList[i].selectTime);
                                                }
                                                compare();
                                            }
                                        });
                                    }else {//未勾中
                                        var end_date = new Date($('#end').val().replace(/-/g,"/"));
                                        var start_date = new Date($('#start').val().replace(/-/g,"/"));
                                        if($('#weekOrMonth').val() =="week"){

                                            var timeDiffer=(end_date-start_date)/(1000*3600*24);//时间差N天
                                            if(timeDiffer+1<14){
                                                alert("按周显示时间范围至少为两周！");
                                                return null;
                                            }
                                        }else if($('#weekOrMonth').val() =="month"){

                                            if((end_date-start_date)/(1000*3600*24)+1<60){
                                                alert("按月显示时间范围至少为两个月（60天）！");
                                                return null;
                                            }
                                        }else{
                                            /* var timeDiffer=(end_date-start_date)/(1000*3600*24); */
                                            if((end_date-start_date)/(1000*3600*24)+1<2){
                                                alert("按日显示时间范围至少为两天！");
                                                return null;
                                            }
                                        }

                                        $.ajax({
                                            url: '/admin/statistics/queryInvestmentStatiticsByTime.html',
                                            type: 'post',
                                            data:{
                                                "start":$('#start').val(),
                                                "end":$('#end').val(),
                                                "showType":$('#weekOrMonth').val()
                                            },
                                            dataType: 'json',
                                            success: function (data) {
                                                alllist.length=0;
                                                xarray.length=0;
                                                alllist=data.resultData.result;
                                                if($('#weekOrMonth').val()=="day"){
                                                    for(var i=alllist.length-1;i>=0;i--){
                                                        xarray.push(alllist[i].selectTime);
                                                    }
                                                    test();
                                                }else if($('#weekOrMonth').val()=="week"){
                                                    for(var i=0;i<alllist.length;i++){
                                                        xarray.push(alllist[i].selectTime);
                                                    }
                                                    test();
                                                }else if($('#weekOrMonth').val()=="month"){
                                                    for(var i=0;i<alllist.length;i++){
                                                        xarray.push(alllist[i].selectTime);
                                                    }
                                                    test();
                                                }
                                            }
                                        });
                                    }
                                }

                                $(document).ready(function() {
                                    $("#compareDiv").hide();
                                    var yarray2=[];
                                    var selectValue=$('#source').val();
                                    for(var i=alllist.length-1;i>=0;i--){
                                        xarray.push(alllist[i].selectTime);
                                        yarray.push(alllist[i].investmentNum);//投资人数
                                        yarray2.push(alllist[i].newInvestmentNum);//首投人数
                                    }
                                    /*   <#list list as item>
                                      xarray.push('${item.selectTime}');
                                      yarray.push('${item.activeNum}');
                                      </#list> */

                                    chart = new Highcharts.Chart({
                                        chart: {
                                            renderTo: 'container',
                                            defaultSeriesType: 'line',
                                            margin: [50, 150, 60, 100]
                                        },
                                        credits:{
                                            enabled:false
                                        },
                                        title: {
                                            text: '',
                                            style: {
                                                margin: '10px 100px 0 0' // center it
                                            }
                                        },

                                        xAxis: {
                                            tickInterval:2,
                                            categories: xarray
                                        },
                                        yAxis: {
                                            title: {
                                                text: 'value'

                                            },
                                            plotLines: [{
                                                value: 0,
                                                width: 1,
                                                color: '#808080'
                                            }]
                                        },
                                        tooltip: {
                                            formatter: function() {
                                                return '<b>'+ this.series.name +'</b><br/>'+
                                                    this.x +': '+ this.y;
                                            }
                                        },
                                        legend: {
                                            enable:false,
                                            layout: 'vertical',
                                            align: "right", //程度标的目标地位
                                            verticalAlign: "top", //垂直标的目标地位
                                            x: 0, //间隔x轴的间隔
                                            y: 100 //间隔Y轴的间隔
                                        },
                                        series: [{data:yarray},{data:yarray2}]
                                    });
                                    chart.series[0].name='投资人数';
                                    chart.series[1].name='首投人数';
                                });


                                function compare(){
                                    //获取勾中的列值复选框，且只能勾选一个
                                    var $chks = $("#myform :checkbox:checked");
                                    var nameArr = [];
                                    $chks.each(function () {
                                        if ($.inArray($(this).attr("value"), nameArr) == -1) {
                                            nameArr.push($(this).attr("value"));
                                        }
                                    });
                                    if(nameArr.length==0){
                                        alert("请勾选一个列值");
                                        return null;
                                    }else if(nameArr.length>1){
                                        alert("只能勾选一个列值");
                                        return null;
                                    }
                                    //重新画图
                                    var arr=[];//可能第一个时间段比第二个时间段短，那么X轴时间段会出问题
                                    var angle=0;//步长
                                    if(xOneArr.length>xTwoArr.length){
                                        angle= parseInt(xOneArr.length/5);
                                        arr=xOneArr;
                                    }else{
                                        angle= parseInt(xTwoArr.length/5);
                                        arr=xTwoArr
                                    }

                                    chart = new Highcharts.Chart({
                                        chart: {
                                            renderTo: 'container',
                                            defaultSeriesType: 'line',
                                            margin: [50, 150, 60, 80]
                                        },
                                        credits:{
                                            enabled:false
                                        },
                                        title: {
                                            text: '',
                                            style: {
                                                margin: '10px 100px 0 0' // center it
                                            }
                                        },

                                        xAxis: {
                                            tickInterval:angle,
                                            categories: arr/* ,
                            					 	 labels:{
                            					 	 	x:-8, //调节x偏移
                            		                    rotation:angle//调节倾斜角度偏移
                            		                 }   */
                                        },
                                        yAxis: {
                                            title: {
                                                text: 'value'
                                            },
                                            plotLines: [{
                                                value: 0,
                                                width: 1,
                                                color: '#808080'
                                            }]
                                        },
                                        tooltip: {
                                            formatter: function() {
                                                var xTime="";
                                                var position=0;
                                                for(var i=0;i<xOneArr.length;i++){
                                                    if(xOneArr[i]==this.x){
                                                        position=i;
                                                        break;
                                                    }
                                                }
                                                if(yOneArr[position]==this.y){
                                                    xTime=xOneArr[position];
                                                }else{
                                                    xTime=xTwoArr[position];
                                                }

                                                /*  if(this.y==yOneArr[this.x]){//鼠标停留在第一条线上   ,双线交叉值相等
                                                     xTime=xOneArr[this.x];
                                                 }else{//鼠标停留在第二条线上
                                                     xTime=xTwoArr[this.x];
                                                 }	 */
                                                return '<b>'+ this.series.name +'</b><br/>'+
                                                    xTime +': '+ this.y;
                                            }
                                        },
                                        legend: {
                                            layout: 'vertical',
                                            align: "right", //程度标的目标地位
                                            verticalAlign: "top", //垂直标的目标地位
                                            x: 0, //间隔x轴的间隔
                                            y: 100 //间隔Y轴的间隔
                                        },
                                        series: [{data:[]},{data:[]}]
                                    });
                                    for(var k=oneList.length-1;k>=0;k--){
                                        if(nameArr[0]==2){yOneArr.push(oneList[k].activeNum);}
                                        if(nameArr[0]==3){yOneArr.push(oneList[k].registerNum);}
                                        if(nameArr[0]==4){yOneArr.push(Math.round(oneList[k].registerNum/oneList[k].activeNum*100*100)/100);}
                                        if(nameArr[0]==5){yOneArr.push(oneList[k].realNameNum);}
                                        if(nameArr[0]==6){yOneArr.push(Math.round(oneList[k].realNameNum/oneList[k].registerNum*100*100)/100);}
                                        if(nameArr[0]==7){yOneArr.push(oneList[k].investmentNum);}
                                        if(nameArr[0]==8){yOneArr.push(oneList[k].newInvestmentNum);}
                                        if(nameArr[0]==9){yOneArr.push(Math.round(alllist[k].newInvestmentAccount/alllist[k].investmentTotal*100*100)/100);}
                                        if(nameArr[0]==10){yOneArr.push(oneList[k].newInvestmentAccount);}
                                        if(nameArr[0]==11){yOneArr.push(oneList[k].investmentTotal);}
                                        if(nameArr[0]==12){yOneArr.push(oneList[k].paymentAccount);}
                                        if(nameArr[0]==13){yOneArr.push(oneList[k].investmentTotal-oneList[k].paymentAccount);}
                                        if(nameArr[0]==14){yOneArr.push(Math.round(oneList[k].investmentTotal/oneList[k].investmentNum*100*100)/100);}
                                        if(nameArr[0]==15){yOneArr.push(Math.round(oneList[k].avgLimit/30*100)/100);}
                                        if(nameArr[0]==16){yOneArr.push(oneList[k].yearInvestment);}
                                        if(nameArr[0]==17){yOneArr.push( Math.round((oneList[k].investmentTotal-oneList[k].newInvestmentAccount)/oneList[k].paymentAccount*100*100 )/100);}
                                        if(nameArr[0]==18){yOneArr.push(oneList[k].balanceCashNum);}
                                    }
                                    for(var k=twoList.length-1;k>=0;k--){
                                        if(nameArr[0]==2){yTwoArr.push(twoList[k].activeNum);}
                                        if(nameArr[0]==3){yTwoArr.push(twoList[k].registerNum);}
                                        if(nameArr[0]==4){yTwoArr.push(Math.round(twoList[k].registerNum/twoList[k].activeNum*100*100)/100);}
                                        if(nameArr[0]==5){yTwoArr.push(twoList[k].realNameNum);}
                                        if(nameArr[0]==6){yTwoArr.push(Math.round(twoList[k].realNameNum/twoList[k].registerNum*100*100)/100);}
                                        if(nameArr[0]==7){yTwoArr.push(twoList[k].investmentNum);}
                                        if(nameArr[0]==8){yTwoArr.push(twoList[k].newInvestmentNum);}
                                        if(nameArr[0]==9){yTwoArr.push(Math.round(alllist[k].newInvestmentAccount/alllist[k].investmentTotal*100*100)/100);}
                                        if(nameArr[0]==10){yTwoArr.push(twoList[k].newInvestmentAccount);}
                                        if(nameArr[0]==11){yTwoArr.push(twoList[k].investmentTotal);}
                                        if(nameArr[0]==12){yTwoArr.push(twoList[k].paymentAccount);}
                                        if(nameArr[0]==13){yTwoArr.push(twoList[k].investmentTotal-twoList[k].paymentAccount);}
                                        if(nameArr[0]==14){yTwoArr.push(Math.round(twoList[k].investmentTotal/twoList[k].investmentNum*100*100)/100);}
                                        if(nameArr[0]==15){yTwoArr.push(Math.round(twoList[k].avgLimit/30*100)/100);}
                                        if(nameArr[0]==16){yTwoArr.push(twoList[k].yearInvestment);}
                                        if(nameArr[0]==17){yTwoArr.push( Math.round((twoList[k].investmentTotal-twoList[k].newInvestmentAccount)/twoList[k].paymentAccount*100*100 )/100);}
                                        if(nameArr[0]==18){yTwoArr.push(twoList[k].balanceCashNum);}
                                    }
                                    /* alert(yOneArr);
                                    alert(yTwoArr); */
                                    chart.series[0].name=$('#start').val()+'至'+$('#end').val();
                                    chart.series[1].name=$('#thestart').val()+'至'+$('#theend').val();
                                    chart.series[0].setData(yOneArr);
                                    chart.series[1].setData(yTwoArr);
                                }

                                function test() {
                                    //获取勾中的复选框
                                    var $chks = $("#myform :checkbox:checked");
                                    var nameArr = [];
                                    $chks.each(function () {
                                        if ($.inArray($(this).attr("value"), nameArr) == -1) {
                                            nameArr.push($(this).attr("value"));
                                        }
                                    });
                                    if(nameArr.length==0){
                                        alert("请至少选中一个列值！");
                                        return null;
                                    }
                                    /*  alert(nameArr); */
                                    //新建一个chart对象
                                    var angle=0;//
                                    angle= parseInt(xarray.length/5);
                                    chart = new Highcharts.Chart({
                                        chart: {
                                            renderTo: 'container',
                                            defaultSeriesType: 'line',
                                            margin: [50, 150, 60, 80]
                                        },
                                        credits:{
                                            enabled:false
                                        },
                                        title: {
                                            text: '',
                                            style: {
                                                margin: '10px 100px 0 0' // center it
                                            }
                                        },

                                        xAxis: {
                                            tickInterval:angle,
                                            categories: xarray/* ,
                            					 	 labels:{
                            					 		x:-8,//调节x偏移
                            		                    rotation:angle//调节倾斜角度偏移
                            		                 }  */
                                        },
                                        yAxis: {
                                            title: {
                                                text: 'value'
                                            },
                                            plotLines: [{
                                                value: 0,
                                                width: 1,
                                                color: '#808080'
                                            }]
                                        },
                                        tooltip: {
                                            formatter: function() {
                                                return '<b>'+ this.series.name +'</b><br/>'+
                                                    this.x +': '+ this.y;
                                            }
                                        },
                                        legend: {
                                            layout: 'vertical',
                                            align: "right", //程度标的目标地位
                                            verticalAlign: "top", //垂直标的目标地位
                                            x: 0, //间隔x轴的间隔
                                            y: 100 //间隔Y轴的间隔
                                        },
                                        series: [{data:[]},{data:[]},{data:[]},{data:[]},{data:[]},{data:[]}]
                                    });
                                    //循环为chart 的 series 的name和data赋值
                                    if($('#weekOrMonth').val()=="day"){
                                        for(var i=0;i<nameArr.length;i++){
                                            chart.series[i].name=columnArr[nameArr[i]-2];
                                            yarray.length=0;
                                            for(var k=alllist.length-1;k>=0;k--){
                                                if(nameArr[i]==2){
                                                    yarray.push(alllist[k].activeNum);
                                                }
                                                if(nameArr[i]==3){
                                                    yarray.push(alllist[k].registerNum);
                                                }
                                                if(nameArr[i]==4){
                                                    /* Math.round(num*100)/100 */
                                                    yarray.push(Math.round(alllist[k].registerNum/alllist[k].activeNum*100*100)/100);
                                                }
                                                if(nameArr[i]==5){
                                                    yarray.push(alllist[k].realNameNum);
                                                }
                                                if(nameArr[i]==6){
                                                    yarray.push(Math.round(alllist[k].realNameNum/alllist[k].registerNum*100*100)/100);
                                                }
                                                if(nameArr[i]==7){
                                                    yarray.push(alllist[k].investmentNum);
                                                }
                                                if(nameArr[i]==8){
                                                    yarray.push(alllist[k].newInvestmentNum);
                                                }
                                                if(nameArr[i]==9){
                                                    yarray.push(Math.round(alllist[k].newInvestmentAccount/alllist[k].investmentTotal*100*100)/100);
                                                }
                                                if(nameArr[i]==10){
                                                    yarray.push(alllist[k].newInvestmentAccount);
                                                }
                                                if(nameArr[i]==11){
                                                    yarray.push(alllist[k].investmentTotal);
                                                }
                                                if(nameArr[i]==12){
                                                    yarray.push(alllist[k].paymentAccount);
                                                }
                                                if(nameArr[i]==13){
                                                    yarray.push(alllist[k].investmentTotal-alllist[k].paymentAccount);
                                                }
                                                if(nameArr[i]==14){
                                                    yarray.push(Math.round(alllist[k].investmentTotal/alllist[k].investmentNum*100*100)/100);
                                                }
                                                if(nameArr[i]==15){
                                                    yarray.push(Math.round(alllist[k].avgLimit/30*100)/100);
                                                }
                                                if(nameArr[i]==16){
                                                    yarray.push(alllist[k].yearInvestment);
                                                }
                                                if(nameArr[i]==17){
                                                    yarray.push( Math.round((alllist[k].investmentTotal-alllist[k].newInvestmentAccount)/alllist[k].paymentAccount*100*100 )/100);
                                                }
                                                if(nameArr[i]==18){
                                                    yarray.push(alllist[k].balanceCashNum);
                                                }
                                            }
                                            chart.series[i].setData(yarray);
                                        }
                                    }else if($('#weekOrMonth').val()=="week"){
                                        for(var i=0;i<nameArr.length;i++){
                                            chart.series[i].name=columnArr[nameArr[i]-2];
                                            yarray.length=0;
                                            for(var k=0;k<alllist.length;k++){
                                                var timeArr=xarray[k].split("至");
                                                var timeDiffer=(new Date(timeArr[1].replace(/-/g,"/"))-new Date(timeArr[0].replace(/-/g,"/")))/(1000*3600*24)+1;
                                                if(nameArr[i]==2){yarray.push(alllist[k].activeNum);}
                                                if(nameArr[i]==3){yarray.push(alllist[k].registerNum);}
                                                if(nameArr[i]==4){yarray.push(Math.round(alllist[k].registerNum/alllist[k].activeNum*100*100)/100);}
                                                if(nameArr[i]==5){yarray.push(alllist[k].realNameNum);}
                                                if(nameArr[i]==6){ yarray.push(Math.round(alllist[k].realNameNum/alllist[k].registerNum*100*100)/100);}
                                                if(nameArr[i]==7){yarray.push(alllist[k].investmentNum);}
                                                if(nameArr[i]==8){yarray.push(alllist[k].newInvestmentNum);}
                                                if(nameArr[i]==9){yarray.push(Math.round(alllist[k].newInvestmentAccount/alllist[k].investmentTotal*100*100)/100);}
                                                if(nameArr[i]==10){yarray.push(alllist[k].newInvestmentAccount);}
                                                if(nameArr[i]==11){yarray.push(alllist[k].investmentTotal);}
                                                if(nameArr[i]==12){yarray.push(alllist[k].paymentAccount);}
                                                if(nameArr[i]==13){yarray.push(alllist[k].investmentTotal-alllist[k].paymentAccount);}
                                                if(nameArr[i]==14){yarray.push(Math.round(alllist[k].investmentTotal/alllist[k].investmentNum*100*100)/100);}
                                                if(nameArr[i]==15){yarray.push(Math.round(alllist[k].avgLimit/timeDiffer/30*100)/100);}
                                                if(nameArr[i]==16){yarray.push(Math.round(alllist[k].yearInvestment/timeDiffer*100)/100);}
                                                if(nameArr[i]==17){yarray.push( Math.round((alllist[k].investmentTotal-alllist[k].newInvestmentAccount)/alllist[k].paymentAccount*100*100 )/100);}
                                                if(nameArr[i]==18){yarray.push(alllist[k].balanceCashNum);}
                                            }
                                            chart.series[i].setData(yarray);
                                        }
                                    }else if($('#weekOrMonth').val()=="month"){
                                        for(var i=0;i<nameArr.length;i++){
                                            chart.series[i].name=columnArr[nameArr[i]-2];
                                            yarray.length=0;
                                            for(var k=0;k<alllist.length;k++){
                                                var timeArr=xarray[k].split("至");
                                                var timeDiffer=(new Date(timeArr[1].replace(/-/g,"/"))-new Date(timeArr[0].replace(/-/g,"/")))/(1000*3600*24)+1;
                                                if(nameArr[i]==2){yarray.push(alllist[k].activeNum);}
                                                if(nameArr[i]==3){yarray.push(alllist[k].registerNum);}
                                                if(nameArr[i]==4){yarray.push(Math.round(alllist[k].registerNum/alllist[k].activeNum*100*100)/100);}
                                                if(nameArr[i]==5){yarray.push(alllist[k].realNameNum);}
                                                if(nameArr[i]==6){ yarray.push(Math.round(alllist[k].realNameNum/alllist[k].registerNum*100*100)/100);}
                                                if(nameArr[i]==7){yarray.push(alllist[k].investmentNum);}
                                                if(nameArr[i]==8){yarray.push(alllist[k].newInvestmentNum);}
                                                if(nameArr[i]==9){yarray.push(Math.round(alllist[k].newInvestmentAccount/alllist[k].investmentTotal*100*100)/100);}
                                                if(nameArr[i]==10){yarray.push(alllist[k].newInvestmentAccount);}
                                                if(nameArr[i]==11){yarray.push(alllist[k].investmentTotal);}
                                                if(nameArr[i]==12){yarray.push(alllist[k].paymentAccount);}
                                                if(nameArr[i]==13){yarray.push(alllist[k].investmentTotal-alllist[k].paymentAccount);}
                                                if(nameArr[i]==14){yarray.push(Math.round(alllist[k].investmentTotal/alllist[k].investmentNum*100*100)/100);}
                                                if(nameArr[i]==15){yarray.push(Math.round(alllist[k].avgLimit/timeDiffer/30*100)/100);}
                                                if(nameArr[i]==16){yarray.push(Math.round(alllist[k].yearInvestment/timeDiffer*100)/100);}
                                                if(nameArr[i]==17){yarray.push( Math.round((alllist[k].investmentTotal-alllist[k].newInvestmentAccount)/alllist[k].paymentAccount*100*100 )/100);}
                                                if(nameArr[i]==18){yarray.push(alllist[k].balanceCashNum);}
                                            }
                                            chart.series[i].setData(yarray);
                                        }
                                    }
                                }
                                //翻页方法
                                function  page(n){
                                    if(n=="first"){//首页
                                        refreshTable(1);
                                    }else if(n=="last"){//尾页
                                        refreshTable(totalPage);
                                    }else if(n=="before"){//上一页
                                        if(currentPage==1){
                                            return null;
                                        }else{
                                            refreshTable(currentPage-1);
                                        }
                                    }else if(n="after"){//下一页
                                        if(currentPage==totalPage){
                                            return null;
                                        }else{
                                            refreshTable(currentPage+1);
                                        }
                                    }

                                }
                                //刷新表格中的数据
                                function refreshTable(p) {
                                    refreshList.length=0;
                                    $.ajax({
                                        url: '/admin/statistics/refreshTable.html',
                                        type: 'post',
                                        data:{
                                            "startTime":$('#start').val(),
                                            "endTime":$('#end').val(),
                                            "page":p
                                        },
                                        dataType: 'json',
                                        success: function (data) {
                                            refreshList=data.resultData.result;//单页数据

                                            totalNum=data.resultData.totalNum;//刷新表格数据时，更新翻页 总条数
                                            currentPage=data.resultData.currentPage;//更新当前页
                                            totalPage=data.resultData.totalPage;
                                            var sum=data.resultData.sum;//汇总数据
                                            var sHtml = "";
                                            $(".data-list").html('');
                                            sHtml='<tr class="header">'+
                                                ' <th>日期</th>'+
                                                '<th class="number">激活数</th>'+
                                                ' <th class="number">注册数</th>'+
                                                '<th class="number">注册率</th>'+
                                                ' <th class="number">实名认证</th>'+
                                                ' <th class="number">认证率</th>'+
                                                ' <th class="number">投资人数</th>'+
                                                ' <th class="number">首投人数</th>'+
                                                ' <th class="number">首投金额</th>'+
                                                '<th class="number">投资总额</th>'+
                                                '<th class="number">首投占比</th>'+
                                                '<th class="number">回款额</th>'+
                                                '<th class="number">提现金额</th>'+
                                                '<th class="number">新增待收</th>'+
                                                '<th class="number">人均投资</th>'+
                                                '<th class="number">平均期限</th>'+
                                                '<th class="number">年化投资额</th>'+
                                                ' <th class="number">回款复投率</th> '+
                                                '</tr>';

                                            for(var i=0;i<refreshList.length;i++){
                                                var aRefresh=(refreshList[i].registerNum/refreshList[i].activeNum*100).toFixed(2);//注册率
                                                var bRefresh=(refreshList[i].realNameNum/refreshList[i].registerNum*100).toFixed(2);//实名认证率
                                                var cRefresh=(refreshList[i].newInvestmentAccount/refreshList[i].investmentTotal*100).toFixed(2);//首投率
                                                var dRefresh=(refreshList[i].investmentTotal-refreshList[i].paymentAccount).toFixed(2);//新增待收
                                                var eRefresh=(refreshList[i].investmentTotal/refreshList[i].investmentNum).toFixed(2);//人均投资
                                                var fRefresh=(refreshList[i].avgLimit/30).toFixed(2);//平均期限
                                                var gRefresh=((refreshList[i].investmentTotal-refreshList[i].newInvestmentAccount)/refreshList[i].paymentAccount*100).toFixed(2);
                                                if(i%2){
                                                    sHtml+='<tr class="s color">';
                                                }else{
                                                    sHtml+='<tr class="s">';
                                                }
                                                sHtml+='<td>'+refreshList[i].selectTime+'</td>';
                                                sHtml+='<td>'+refreshList[i].activeNum+'</td>';
                                                sHtml+='<td>'+refreshList[i].registerNum+'</td>';
                                                sHtml+='<td>'+aRefresh+'%'+'</td>';
                                                sHtml+='<td>'+refreshList[i].realNameNum+'</td>';
                                                sHtml+='<td>'+bRefresh+'%'+'</td>';
                                                sHtml+='<td>'+refreshList[i].investmentNum+'</td>';
                                                sHtml+='<td>'+refreshList[i].newInvestmentNum+'</td>';
                                                sHtml+='<td>'+refreshList[i].newInvestmentAccount+'</td>';
                                                sHtml+='<td>'+refreshList[i].investmentTotal+'</td>';
                                                sHtml+='<td>'+cRefresh+'%</td>';
                                                sHtml+='<td>'+refreshList[i].paymentAccount+'</td>';
                                                sHtml+='<td>'+refreshList[i].balanceCashNum+'</td>';
                                                sHtml+='<td>'+dRefresh+'</td>';
                                                sHtml+='<td>'+eRefresh+'</td>';
                                                sHtml+='<td>'+fRefresh+'月'+'</td>';
                                                sHtml+='<td>'+refreshList[i].yearInvestment+'</td>';
                                                sHtml+='<td>'+gRefresh+'%'+'</td>';
                                                sHtml+='</tr>';
                                            }
                                            //汇总数据行
                                            sHtml+='<tr style="font-weight:bold;" bgcolor="#f2f2f2">'+
                                                ' <td >汇总</th>'+
                                                '<td>'+sum.activeNum+'</td>'+
                                                ' <td>'+sum.registerNum+'</td>'+
                                                '<td>'+(sum.registerNum/sum.activeNum*100).toFixed(2)+'%</td>'+
                                                ' <td>'+sum.realNameNum+'</td>'+
                                                ' <td>'+(sum.realNameNum/sum.registerNum*100).toFixed(2)+'%</td>'+
                                                ' <td>'+sum.investmentNum+'</td>'+
                                                ' <td>'+sum.newInvestmentNum+'</td>'+
                                                ' <td>'+sum.newInvestmentAccount+'</td>'+
                                                '<td>'+sum.investmentTotal+'</td>'+
                                                '<td>'+(sum.newInvestmentAccount/sum.investmentTotal*100).toFixed(2)+'%</td>'+
                                                '<td>'+sum.paymentAccount.toFixed(2)+'</td>'+
                                                '<td>'+sum.balanceCashNum.toFixed(2)+'</td>'+
                                                '<td>'+(sum.investmentTotal-sum.paymentAccount).toFixed(2)+'</td>'+
                                                '<td>'+(sum.investmentTotal/sum.investmentNum).toFixed(2)+'</td>'+
                                                '<td>'+(sum.avgLimit/30/totalNum).toFixed(2)+'月</td>'+
                                                '<td>'+sum.yearInvestment.toFixed(2)+'</td>'+
                                                ' <td>'+((sum.investmentTotal-sum.newInvestmentAccount)/sum.paymentAccount*100).toFixed(2)+'%</td> '+
                                                '</tr>';
                                            $(".data-list").html(sHtml);
                                            //刷新表格完成后
                                            $("#currentTimeBalance").html('&nbsp;&nbsp;&nbsp;'+'站岗资金:'+data.resultData.currentTimeBalance.toFixed(2)+'元');
                                            $("#investmentAll").html('投资总额:'+data.resultData.investmentAll.toFixed(2)+'元');
                                            $("#collectionAll").html('新增待收总额:'+data.resultData.collectionAll.toFixed(2)+'元');
                                            $("#yearAccountAll").html('年化总额:'+data.resultData.yearAccountAll.toFixed(2)+'元');
                                            $("#currentTimeCollection").html('实时待收额:'+data.resultData.currentTimeCollection.toFixed(2)+'元');

                                            $("#totalNum").html('共'+totalNum+'条');
                                            $("#currentPage").html('当前第'+currentPage+'页');

                                        }
                                    });
                                }
                            </script>
                        </div>
        </div>
    </div>
    <div class="mc-b">
        <#include "../foot.html">
    </div>
    <#include "../jsPage.html">
    </body>
</html>